package cn.saddyfire.pattern.flyweight;

/**
 * @author Dee
 * @date 2024/2/4
 * <p>Description:
 */
public class Client {
    public static void main(String[] args) {
        //获取I图形对象
        AbastractBox box1 = BoxFactory.getInstance().getShape("I");
        box1.display("灰色");
        //获取L图形对象
        AbastractBox box2 = BoxFactory.getInstance().getShape("L");
        box2.display("绿色");
        //获取O图形对象
        AbastractBox box3 = BoxFactory.getInstance().getShape("O");
        box3.display("紫色");
        //获取O图形对象
        AbastractBox box4 = BoxFactory.getInstance().getShape("O");
        box4.display("红色");
        System.out.println("两次获取到的O图形是否是一个对象: " + (box3 == box4));
    }
}
